<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <audio id="j-bgm" src="./assets/bgm.mp3"></audio>
  <div class="music-btn off"></div>

  <!-- 动画 -->
  <div class="view">
    <!-- 太阳 -->
    <div class="sun"></div>

    <!-- 秋千 -->
    <div class="art">
      <div class="swing">

        <div class="leg1">
          <div class="jiojio"></div>
        </div>

        <div class="leg2">
          <div class="jiojio"></div>
        </div>

        <!-- 脖子 -->
        <div class="neck"></div>
        <!-- 头 -->
        <div class="head">
          <div class="part"></div>
        </div>

      </div>
    </div>

    <!-- 文字 -->
    <div class="paras">
        <p class="para f-animLineUp" style="transition-delay: 0.2s;">
          <em class="s-fcRed">11月1日</em>
        </p>
        <p class="para f-animLineUp" style="transition-delay: 0.3s;">
          大概是很特别的一天
        </p>
        <p class="para f-animLineUp" style="transition-delay: 0.4s;">
          这一天里
        </p>
        <p class="para f-animLineUp" style="transition-delay: 0.5s;">
          TA把Richard Clayderma...的
          <em class="s-fcRed">《梦中的婚礼》</em>
        </p>
        <p class="para f-animLineUp" style="transition-delay: 0.6s;">
          反复听了
          <em class="s-fcRed">10次</em>
        </p>
      </div>
  </div>



  
  <script>
    const musicBtn = document.querySelector('.music-btn')
    const bgMusic = document.getElementById('j-bgm')
    let isPlay = false

    musicBtn.addEventListener('click', function() {
      musicBtn.classList.toggle('off')
      isPlay = !isPlay
      if (isPlay) {
        bgMusic.play()
      } else {
        bgMusic.pause()
      }
    })
  </script>
</body>
</html>